import { InputElement } from '@dom-native/ui';
import { customElement, elem } from 'dom-native';
import { isNil } from 'utils-min';

@customElement("c-input")
export class CustomInputElement extends InputElement {
	inputEl!: HTMLInputElement

	static get observedAttributes() { return InputElement.observedAttributes.concat(['maxlength']) }

	//#region    ---------- BaseInput Implementations ---------- 
	createIptEl(): HTMLInputElement {
		const maxlength = this.getAttribute("maxlength");

		//// Build the component HTML
		const el = elem('input') as HTMLInputElement;
		if (!isNil(maxlength)) {
			el.setAttribute('maxlength', maxlength!);
		}
		return el;
	}
	//#endregion ---------- /BaseInput Implementations ---------- 

}
